<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<link rel='stylesheet' type='text/css' href='/static/view/css/head.css'>
		<link rel='stylesheet' type='text/css' href='/static/view/css/common.css'>
                <link rel='stylesheet' type='text/css' href='/static/view/css/forumDetail.css'>
                <style type="text/css">.test{border: 1px solid red;}</style>
                <script type='text/javascript' src='/static/ckeditor/ckeditor.js'></script>
		<title>论坛</title>
	</head>
	<body>
		
	<div id='head'>
		<div id='head-navi'><a href='http://localhost:8080/index.php' onclick="setHomepage('http://localhost:8080/index.php')">设为首页</a>&nbsp;<b>|</b>&nbsp;<a href='http://localhost:8080/index.php' onclick="alert('请按Ctrl+D添加到收藏夹')">收藏本站</a></div>
		<div id='head-navi-bottom'>
                    <div class='logo'><a href='/User/forum/forum.html' onfocus="this.blur()"><img src='/static/view/image/banner/logo.png'/></a></div>
                    <div class='status'>
                        <?php if(empty($_SESSION['userInfo'])){ echo "<a href='/User/user/login'>登录</a> | "; echo "<a href='/User/user/register'>注册</a>"; }else if($_SESSION['userInfo']['role']=='普通用户'){ echo '欢迎会员<a href='.'/User/user/userInfo?id='.$_SESSION['userInfo']['id'].'>'.$_SESSION['userInfo']['username'].'</a>登录'.'<br/>'.'积分：'.$_SESSION['userInfo']['credits'].'&nbsp;|&nbsp;'.'用户组:'.$_SESSION['userInfo']['role']; echo "      <a href='/User/user/logout/'><input type='button' value='安全退出'></a>"; }else if($_SESSION['userInfo']['role']=='管理员'){ echo '欢迎管理员<a href='.'/User/user/userInfo?id='.$_SESSION['userInfo']['id'].'>'.$_SESSION['userInfo']['username'].'</a>登录'.'<br/>'.'积分：'.$_SESSION['userInfo']['credits'].'&nbsp;|&nbsp;'.'用户组:'.$_SESSION['userInfo']['role']; echo '&nbsp;|&nbsp;<a href="/Admin/user/userList">进入管理中心</a>'; echo "&nbsp;|&nbsp;<a href='/User/user/logout/'><font><b>安全退出</b></font></a>"; } ?>
                    </div>	
            </div>
	</div>
	
	<div id='navi'>
            <ul>
                <li><a href='/User/forum/forum.html'>论坛</a></li>
                <!--<li><a href='/User/user/login.html'>登录</a></li>-->
                <li><a href='/User/user/register.html'>注册</a></li>
                <li><a href='/User/user/findPassword.html'>找回密码</a></li>
                <!--<li><a href='/User/posts/postsList.html'>帖子列表</a></li>-->
                <!--<li><a href='/User/user/searchForum.html'>搜索</a></li>-->
                <!--<li><a href='/User/user/notice.html'>通知</a></li>-->
                <!--<li><a href='/User/forum/aboutUs.html'>关于我们</a></li>-->
                <!--<li><a href="/User/user/logout">安全退出</a></li>-->
            </ul>
	</div>
	<div id='search'>
            <form action='/User/posts/postsSearch' method='post'>
                <label for='search-content'><span style="font-weight:700;">搜索帖子</span></label>
               
                <input id='search-content' class='content' name='theme' type='text' results="n" placeholder='帖子主题' required autocomplete="on" x-webkit-speech speech/>

                <button type='submit'>搜索</button><font style="color:blue;font-weight: 700">　<?php echo '今天是'.date('Y-m-d',time()).'　'.date('D',time()); ?>　<span id="clock"></span></font>
            </form>
	</div>
        <script type='text/javascript' src='/static/view/js/clock.js'></script>
        <script type='text/javascript'>
           startTime();
	$(document).ready(function(){
		/*$('#head-submit').live('click',function(){
                    if($.trim($('#head-username').val())==''||$.trim($('#head-password').val())==''){
                            window.location.href='./login.html';
                    }else{
                        var data=$('#head-form').serialize();
                        $.ajax({
                            url:'./',
                            data:data,
                            dataType:'html',
                            type:'post',
                            success:function(){
                                    $('#head-form').hide();
                                    $('.status').html("<h3>欢迎会员XX登录</h3>");
                            },
                            error:function(){
                                    window.alert('an error accured');
                            }	
                        });
                    }			
		});
		
		$('#head-username').keydown(function(e){
                    if(e.keyCode == 13){
                        e.preventDefault();
                        if($.trim($(this).val()) != ''){
                                $('#head-password').focus();
                        }else{
                                $(this).attr('placeholder','请输入用户名');
                        }
                    }	
		});
		
		$('#head-password').keydown(function(e){
			if(e.keyCode==13){
                            e.preventDefault();
                            if($.trim($(this).val())!=''){
                                    $('#head-submit').trigger('click');
                        }else{
                                $(this).attr('placeholder','请输入密码');
                                //window.location.href='./login.html';
                            }
			}
		});
		
	});*/
	</script>
	

                <p style="font-size:12px;margin: 0px auto 10px 15px;"><a href="/User/forum/forum">论坛</a> &gt; <a href="/User/forum/forumDetail?id=<?php echo ($forum['id']); ?>"><?php echo ($forum['parent_forum_name']); ?></a> &gt; <a href="/User/forum/forumDetail?id=<?php echo ($forum['id']); ?>"><?php echo ($forum['forum_name']); ?></a></p>
                <div class="container">
                    
                    <html>
    <head>
        <title>leftbar</title>
        <style type="text/css">
            .leftbar{
                color:black;
                font-size: 13px;
                font-weight: 700;
                background-color:#EEF3F6; /*#ECF3F6;*/
                width:200px;
                height:auto;
                border:1px solid #BDD7E3 ;
                margin-left:15px;
                float:left;
            }
            .leftbar ul{
                border:0px solid red;
                list-style-type: none;
                height:100%;
            }
            .leftbar ul li{
                margin-left: -40px;
                padding-left: 60px;
                border:0px solid red;
                height:25px;
                width: auto;
                padding-top: 10px;
            }
            .leftbar ul li:hover{
                background-color: #2B78C8;
            }
            .leftbar ul li:focus{
                background-color: #2B78C8;
            }
            .leftbar ul li:visited{
                background-color: #2B78C8;
            }
        </style>
    </head>
    <div class='leftbar'>
        <ul class='nav nav-list'>
            <?php if(is_array($leftbar)): $i = 0; $__LIST__ = $leftbar;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$navList): $mod = ($i % 2 );++$i; if($navList["type"] == 'parent'): ?><li><?php echo ($navList["forum_name"]); ?></li>
                    <?php else: ?>
                <li><a href="/User/forum/forumDetail?id=<?php echo ($navList["id"]); ?>"><?php echo ($navList["forum_name"]); ?></a></li><?php endif; endforeach; endif; else: echo "" ;endif; ?>
        </ul>
    </div>
</html>

                    
                    <div class="overview">
                        <b><?php echo ($forum['forum_name']); ?></b> 精华帖: <?php echo ($forum['good_posts_count']); ?>|主题: <?php echo ($forum['theme_count']); ?>
                    </div>
                    <div class="posts-btn"><a href="#posts"><button>发帖</button></a></div>
                    <div class="childFurom">
                        <h3>帖子列表</h3>
                        <?php if(empty($list)): ?><h2 style="color:orange;line-height: 2.5;">该版块还是一片净土,欢迎您开垦这片肥沃的土地！！！</h2><?php else: ?>
                            <table border="0px" cellspacing="0" width="1000px" height="200px">
                                <tr><th>ID</th><th>主题</th><th>是否精华帖</th><th>作者</th><th>发表日期</th></tr>
                                <?php if(is_array($list)): $i = 0; $__LIST__ = $list;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$list): $mod = ($i % 2 );++$i;?><tr align="center"><td><?php echo ($list["id"]); ?></td><td><a href="/User/posts/postsDetail?posts_id=<?php echo ($list["id"]); ?>&author_id=<?php echo ($list["author_id"]); ?>&forum_id=<?php echo ($forum['id']); ?>"><?php echo ($list["theme"]); ?></a></td>
                                        <td><?php if($list["is_good"] == 'yes'): ?><h4 style="color:orange;">精华帖</h4><?php else: ?>普通帖<?php endif; ?></td>
                                        <td><?php echo ($list["author"]); ?></td><td><?php echo ($list["dateline"]); ?></td>
                                    </tr><?php endforeach; endif; else: echo "" ;endif; ?>
                            </table><?php endif; ?>
                        <?php echo ($page); ?>
                    </div>
                    <div class="postsPublish"><a name="posts"></a><!--锚点-->
                         <form action="/User/posts/postsPublish" method="post" id="posts-submit">
                                <h3>快速发帖</h3><br/>
                                <input id="theme" name="theme" type="text" required autocomplete="on" placeholder="帖子主题" size="50" style="height: 32px;border: 1px solid #BDD7E3" autocomplete="on" x-webkit-speech speech/><label for="theme">标题栏</label>
                                <input type="button" id="btn_h_type" value="高级模式">
                                <input type="button" id="btn_l_type" value="普通模式" style="display: none">
                                <div style="margin-top:10px;">
                                    <input name="mood" type="radio" value="/static/view/image/mood/001.gif"><img src="/static/view/image/mood/001.gif">
                                    <input name="mood" type="radio" value="/static/view/image/mood/002.gif"><img src="/static/view/image/mood/002.gif">
                                    <input name="mood" type="radio" value="/static/view/image/mood/003.gif"><img src="/static/view/image/mood/003.gif">
                                    <input name="mood" type="radio" value="/static/view/image/mood/004.gif"><img src="/static/view/image/mood/004.gif">
                                    <input name="mood" type="radio" value="/static/view/image/mood/005.gif"><img src="/static/view/image/mood/005.gif">
                                    <input name="mood" type="radio" value="/static/view/image/mood/006.gif"><img src="/static/view/image/mood/006.gif">
                                    <input name="mood" type="radio" value="/static/view/image/mood/007.gif"><img src="/static/view/image/mood/007.gif">
                                    <input name="mood" type="radio" value="/static/view/image/mood/008.gif"><img src="/static/view/image/mood/008.gif">
                                    <input name="mood" type="radio" value="/static/view/image/mood/009.gif"><img src="/static/view/image/mood/009.gif">
                                    <input name="mood" type="radio" value="/static/view/image/mood/010.gif"><img src="/static/view/image/mood/010.gif">
                                    <input name="mood" type="radio" value="/static/view/image/mood/011.gif"><img src="/static/view/image/mood/011.gif">
                                    <input name="mood" type="radio" value="/static/view/image/mood/012.gif"><img src="/static/view/image/mood/012.gif">
                                    <input name="mood" type="radio" value="/static/view/image/mood/013.gif"><img src="/static/view/image/mood/013.gif">
                                </div>

                                    <input name="forum_id" type="hidden" value="<?php echo ($forum['id']); ?>"/>
                                    <input name="posts_id" type="hidden" value="<?php echo ($forum['id']); ?>"/>
                                    <input name="forum_name" type="hidden" value="<?php echo ($forum['forum_name']); ?>"/>
                                    <input name="url" type="hidden" value="/User/forum/forumDetail?id=<?php echo ($forum['id']); ?>"/>
                                    <span id="btn">
                                    <input name="" type="button" value="h1" id="h1" class="btn" title="1号标题"/>
                                    <input name="" type="button" value="h2" id="h2" class="btn" title="2号标题"/>
                                    <input name="" type="button" value="h3" id="h3" class="btn" title="3号标题"/>
                                    <input name="" type="button" value="h4" id="h4" class="btn" title="4号标题"/>
                                    <input name="" type="button" value="h5" id="h5" class="btn" title="5号标题"/>
                                    <input name="" type="button" value="b" id="bold" class="btn" title="粗体"/>
                                    <input name="" type="button" value="i" id="italics" class="btn" title="斜体"/>
                                    <input name="" type="button" value="u" id="underline" class="btn" title="下划线"/>
                                     <!--<button type="button" id="apply" class="btn-mini">apply</button>-->
                                     </span>
                                <p>
                                    <textarea id="selectable" name="content" rows="8" cols="85" style="border:1px solid #BDD7E3"/>
                                    </textarea>
                                </p>
                                <p id="container"></p>
                                <?php if(!empty($_SESSION['userInfo'])){echo "<button type='submit'>发表帖子</button>";}else{echo "您还没登陆，发帖<a href='/User/user/login'>请登录</a>";} ?>
                        </form>
                    </div>
                </div>
                    <div style="margin:20px 15px;color:#6D6D6D;">
        <div style="border-bottom: 1px solid #BDD7E3"></div>
        <div style="padding:10px 0px;line-height: 1.8;">
                <p>Copyright &copy;2012-2013 shaobo,test</p>
                <p>Welcome to our Bulletin Board System.It is our <strong>beta</strong> version,contact <a href="mailto:shaaoboo@sina.com"><font color='blue'>shaaoboo@sina.com</font></a> to give us your valuable suggestion.</p>
        </div>
</div>

               
		<script type='text/javascript' src='/static/view/js/jquery-1.8.3.js'></script>
		<script type='text/javascript'>
                     function getPositions(){
                        var startPosition=endPosition=0;
                        var element=document.getElementById('selectable');
                        if(document.selection){
                            var range=document.selection.createRange();
                            var drange=range.duplicate();
                            drange.moveToElementText(element);
                            drange.setEndPoint('EndToEnd',range);
                            startPosition=drange.text.length-range.text.length;
                            endPosition=startPosition+range.text.length;//alert('ie');
                        }
                        else if(window.getSelection){
                            //firefox chrome safari
                            startPosition=element.selectionStart;
                            endPosition=element.selectionEnd;//alert(endPosition);
                        }
                        return {'start':startPosition,'end':endPosition};
                    }
			$(document).ready(function(){
                           
                               $('#btn_h_type').click(function(){
                                    CKEDITOR.replace( 'selectable', {
                                            uiColor: '#BDD7E3',
                                            toolbarCanCollapse:true,
                                            language :'zh-cn'
                                            //toolbarLocation :''
                                    });
                                    $('#btn').css('display','none');
                                    $('#btn_l_type').css('display','inline');
                                    $('#btn_h_type').css('display','none');
                                });
                                 $('#btn_l_type').click(function(){
                                    document.location.reload();
                                    $('#btn_l_type').css('display','none');
                                    $('#btn_h_type').css('display','inline');
                                });
                               /*格式化文本，给文本选中添加样式，例如斜体，粗体*/
                                $('#apply').click(function(){
                                    $('#container').html($('#selectable').val());
                                });
                                $('.btn').click(function(){
                                    var positions=getPositions();
                                    if(positions.start==positions.end){
                                        return false;
                                    }
                                    var tag=$(this).val();
                                    var textOnPage=$('#selectable').val();
                                    var startString=textOnPage.substr(0, positions.start);
                                    var targetString=textOnPage.substr(positions.start,positions.end-positions.start);
                                    var formattedString="<" + tag+">" + targetString + "</"+tag+">";
                                    var endString=textOnPage.substr(positions.end);//alert(endString+'||'+startString+'||'+formattedString);
                                    $("#selectable").val(startString + formattedString + endString);//alert($("#selectable").val());
                                });
                                /*格式化文本，给文本选中添加样式，例如斜体，粗体*/
                                $('.title').click(function(){
                                    $(this).next('div.container').slideToggle('fast');
                                });
                                $('#posts-submit').submit(function(){
                                    if($.trim($('#selectable').val())==''){
                                        //alert('回复内容不能为空');
                                        return false;
                                    }

                                });
                               
				
			});
		
		</script>
	</body>
</html>